#include <iostream>
#include <sstream>

int ret = 1e9;

void dfs(int goat, int wolf, int boat, int opp_goat, int opp_wolf, int cnt)
{
    if (goat == 0 && wolf == 0)
    {
        ret = std::min(ret, cnt);
        return;
    }

    if (goat + wolf <= boat)
    {
        ret = std::min(ret, cnt + 1);
        return;
    }

    for (int i = 0; i <= std::min(boat, goat); i++)
    {
        for (int j = 0; j <= std::min(boat, wolf); j++)
        {
            if (i + j == 0)
                continue;
            if (i + j > boat)
                break;
            if (goat - i <= wolf - j && goat - i != 0)
                continue;
            if (opp_goat + i <= opp_wolf + j && opp_goat + i != 0)
                break;
            if (opp_goat + i == 0 && opp_wolf + j >= boat)
                break;
            dfs(goat - i, wolf - j, boat, opp_goat + i, opp_wolf + j, cnt + 1);
        }
    }
}

int main()
{
    int goat, wolf, boat;
    std::cin >> goat >> wolf >> boat;

    dfs(goat, wolf, boat, 0, 0, 0);
    std::cout << (ret == 1e9 ? 0 : ret) << std::endl;

    return 0;
}